<route lang="json5">
{
  "style": {
    "navigationBarTitleText": "酒店住宿"
  }
}
</route>

<template>
  <view class="business-list">
    <view class="business-item" v-for="(item, index) in hotels" :key="index">
      <view class="business-image">
        <image :src="item.image" alt="酒店图片" mode="aspectFill"></image>
      </view>
      <view class="business-info">
        <text class="business-name">{{ item.name }}</text>
        <view class="business-meta">
          <text class="business-address">{{ item.address }}</text>
          <text class="business-rating">评分：{{ item.rating }} ★</text>
        </view>
        <view class="business-tags">
          <view class="tag" v-for="(tag, index) in item.tags" :key="index">{{ tag }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script lang="ts" setup>
const hotels = ref([
  {
    name: '豪华酒店',
    checkIn: '14:00',
    checkOut: '12:00',
    image: 'https://sport-card.oss-cn-beijing.aliyuncs.com/trade/trade1.jpg',
    address: '武汉市江汉区某某路',
    rating: 4.9,
    tags: ['豪华', 'SPA', '泳池', '商务'],
  },
  {
    name: '宜家酒店',
    checkIn: '13:00',
    checkOut: '11:00',
    image: 'https://sport-card.oss-cn-beijing.aliyuncs.com/trade/trade2.jpg',
    address: '武汉市青山区某某路',
    rating: 4.5,
    tags: ['经济型', '停车', '家庭'],
  },
  {
    name: '五星级酒店',
    checkIn: '15:00',
    checkOut: '12:00',
    image: 'https://sport-card.oss-cn-beijing.aliyuncs.com/trade/trade3.jpg',
    address: '武汉市武昌区某某路',
    rating: 4.8,
    tags: ['豪华', '会议', '健身房', '商务'],
  },
  // 更多酒店数据
])
</script>

<style scoped>
.business-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* 自动调整列数 */
  gap: 20px;
  padding: 20px;
}

.business-item {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.business-image {
  width: 100%;
  height: 160px;
  overflow: hidden;
}

.business-image image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 确保图片显示完整且不变形 */
}

.business-info {
  padding: 15px;
  text-align: left;
}

.business-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

.business-description {
  font-size: 1.1rem;
  color: #777;
  margin-bottom: 12px;
}

.business-meta {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
}

.business-address {
  font-size: 1rem;
  color: #888;
}

.business-rating {
  font-size: 1rem;
  color: #ffa500; /* 使用橙色显示评分 */
}

.business-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  background-color: #007bff;
  color: #fff;
  padding: 6px 12px;
  border-radius: 15px;
  font-size: 0.875rem;
}

.business-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
</style>
